﻿namespace Mongo.Core.Repository
{
    #region

    using MongoDB.Driver;

    #endregion

    public sealed class MongoDatabaseInstance
    {
        private static readonly MongoDatabaseInstance _instance = new MongoDatabaseInstance();

        private readonly MongoClient _mongoClient;
        private readonly MongoDatabase _mongoDatabase;
        private readonly MongoServer _mongoServer;

        private MongoDatabaseInstance()
        {
            _mongoClient = new MongoClient();
            _mongoServer = _mongoClient.GetServer();
            _mongoDatabase = _mongoServer.GetDatabase("test");
        }

        public MongoClient MongoClient
        {
            get { return _mongoClient; }
        }

        public MongoServer MongoServer
        {
            get { return _mongoServer; }
        }

        public MongoDatabase MongoDatabase
        {
            get { return _mongoDatabase; }
        }

        public static MongoDatabaseInstance Instance
        {
            get { return _instance; }
        }
    }
}
